package UIComponent
{
	
	import flash.display.Shape;
	
	import mx.graphics.Stroke;
	
	import spark.primitives.Line;
	import spark.primitives.supportClasses.StrokedElement;

	public class LineSprite
	{
		//essential
		private var skeleton:LineSkeleton;
		private var canvas:MyCanvas;
		
		//component
		private var line:Line;
		
		//status
		private var selected:Boolean = new Boolean();
		
		public function LineSprite(_skeleton:LineSkeleton, _canvas:MyCanvas)
		{
			skeleton=_skeleton;
			canvas=_canvas;
			
			line=new Line();
			
			selected=false;
		}

		public function getSkeleton():LineSkeleton
		{
			return skeleton;
		}

		public function setSkeleton(value:LineSkeleton):void
		{
			skeleton = value;
		}
		
		public function updateLine():void
		{
			var fromSprite:PointSprite = skeleton.getFromPointSkeleton().getSprite();
			var toSprite:PointSprite = skeleton.getToPointSkeleton().getSprite();
			
			line.xFrom = fromSprite.x + fromSprite.getWidth();
			line.yFrom = fromSprite.y + fromSprite.getHeight()/2;
			line.xTo = toSprite.x;
			line.yTo = toSprite.y + toSprite.getHeight()/2;
		}
		
		public function getLine():Line
		{
			return line;
		}

		public function getSelected():Boolean
		{
			return selected;
		}

		public function setSelected(value:Boolean):void
		{
			selected = value;
		}

	}
}